/*
 * @Descripttion   
 * @version        
 * @Author         Xiaoqi Lai
 * @Date           2021-09-05 23:14:38
 * @LastEditors    Xiaoqi Lai
 * @LastEditTime   2021-09-05 23:14:38
 */
#include "oled_my.h"
#include <stdio.h>
#include <string.h>
#include "esp_log.h"
#include "esp_system.h"
#include "esp_timer.h"
#include "freertos/FreeRTOS.h"
#include "freertos/task.h"
#include "freertos/event_groups.h"

void oled_show_start()
{
    OLED_ShowCHinese(0, 1, 0);
    OLED_ShowCHinese(20, 1, 1);
    OLED_ShowCHinese(40, 1, 2);
    OLED_ShowCHinese(60, 1, 3);
    vTaskDelay(2000 / portTICK_PERIOD_MS);
    OLED_Clear();
}

void oled_show_mac(char *MAC)
{
    OLED_ShowString(0, 1, "MAC:");
    OLED_ShowString(0, 2, MAC);
    vTaskDelay(2000 / portTICK_PERIOD_MS);
    OLED_Clear();
}

void oled_show_wifi_connect()
{
    OLED_ShowString(0, 1, "WIFI");
    OLED_ShowCHinese(40, 1, 4);
    OLED_ShowCHinese(60, 1, 5);
    OLED_ShowCHinese(80, 1, 6);
}

void oled_show_reconnect(int retry_num)
{
    OLED_Clear();
    OLED_ShowCHinese(0, 1, 7);
    OLED_ShowCHinese(20, 1, 8);
    OLED_ShowCHinese(40, 1, 9);
    OLED_ShowCHinese(60, 1, 10);
}

void oled_show_connect_fail()
{
    OLED_Clear();
    OLED_ShowCHinese(0, 1, 10);
    OLED_ShowCHinese(20, 1, 11);
    OLED_ShowCHinese(40, 1, 12);
    OLED_ShowCHinese(60, 1, 13);
    vTaskDelay(2000 / portTICK_PERIOD_MS);
    OLED_Clear();
    OLED_ShowString(0, 1, "Start");
    OLED_ShowString(0, 2, "SmartConfig");
}

void oled_show_smartconfig_find()
{
    OLED_Clear();
    OLED_ShowString(0, 1, "Found channel");
    vTaskDelay(1000 / portTICK_PERIOD_MS);
}

void oled_show_smartconfig_ssid(char *ssid)
{
    OLED_Clear();
    OLED_ShowString(0, 1, "ssid:");
    OLED_ShowString(0, 2, ssid);
    vTaskDelay(1000 / portTICK_PERIOD_MS);
}

void oled_show_wifi_connected()
{
    OLED_Clear();
    OLED_ShowString(0, 1, "WIFI");
    OLED_ShowCHinese(40, 1, 14);
    OLED_ShowCHinese(60, 1, 10);
    OLED_ShowCHinese(80, 1, 11);
}

void oled_http_start_port()
{
    OLED_Clear();
    OLED_ShowString(0, 1, "HTTP start port:");
    OLED_ShowString(0, 2, "80");
}

void oled_http_request(char *msg)
{
    OLED_Clear();
    OLED_ShowString(0, 1, "Request:");
    OLED_ShowString(0, 2, msg);
}

void oled_http_success()
{
    OLED_Clear();
    OLED_ShowCHinese(0, 1, 15);
    OLED_ShowCHinese(20, 1, 16);
    OLED_ShowCHinese(40, 1, 17);
    OLED_ShowCHinese(60, 1, 18);
}

void oled_http_no_answer()
{
    OLED_Clear();
    OLED_ShowCHinese(0, 1, 19);
    OLED_ShowCHinese(20, 1, 20);
    OLED_ShowCHinese(40, 1, 21);
}